<template>
  <div class="container">
    <uv-tabs :list="tabs" :current="current" @click="tabsClick" :scrollable="false"></uv-tabs>

    <uv-empty mode="coupon" v-if="!list.length"></uv-empty>
  </div>
</template>

<script setup lang="ts">
const { proxy } = getCurrentInstance();
const instance = getCurrentInstance();
import useCounterStore from "@/stores/counter";
const counter = useCounterStore();

let params = {
  page: 1,
  limit: 10,
  type: "usable",
};
let current = ref(0);
let tabs = ref([
  { name: "未使用", value: "usable" },
  { name: "已使用/过期", value: "unusable" },
]);
let list = ref([]);

onLoad((e) => {
  uni.setNavigationBarTitle({
    title: e.name,
  });
  getInfo();
});

function tabsClick(e) {
  current.value = e.index;
  params.type = tabs.value[e.index].value;
  params.page = 1;
  list.value = [];
  getInfo();
}

async function getInfo() {
  let resp = await proxy.$shopApis.couponList(params);
  if (!resp) return;
  console.log("优惠券列表", resp);
}
</script>



<style lang="scss" scoped>
.container {
}
</style>